'use strict'

require('./index.css');
require('page/common/nav/index.js');
require('page/common/header/index.js');
var navSide = require('page/common/nav-side/index.js');
var _mm = require('util/mm.js');
var _user = require('service/user-service.js');
var templateIndex = require('./index.string');
$(function(){
    page.init();
});
var page = {
    init : function(){
        this.onLoad();
    },
    onLoad : function(){
        //初始化左侧菜单
        navSide.init({
            name : 'user-center'
        });
        //加载用户信息
        this.loadUserInfo();
    },
    loadUserInfo : function(){
        var userHtml = '';
//        _user.getUserInfo(function(res){
        var res = {
//            "status": 0,
//            "data": {
                "id": 1,
                "username": "wo",
                "password": "",
                "email": "123@163.com",
                "phone": "13800138000",
                "question": "question",
                "answer": "answer",
                "role": 1,
                "createTime": 1478422605000,
                "updateTime": 1491305256000
//            }
        };
            userHtml = _mm.renderHtml(templateIndex,res);
            $('.panel-body').html(userHtml);
//        },function(errMsg){
//            console.log('errMsg=='+errMsg);
//            _mm.errorTips(errMsg);
//        });
    }
};